<?php
/**
 * 热门搜索
 *
 */
defined('InShopNC') or exit('Access Invalid!');
class hotsearchModel extends Model{
    public function __construct() {
        parent::__construct('hotsearch');
    }
    
    /**
     * 获取热门搜索列表
     * @param array $condition
     * @param string $fields
     * @param string $group
     */
    public function getSearchList($condition = array(),$order='',$limit,  $fields = '*',$group = ''){
        return $this->where($condition)->field($fields)->limit(false)->group($group)->order($order)->limit($limit)->select();
    }
    public function storeGetSearchList($condition = array()){
        return $this->where($condition)->select();
    }
    
    /**
     * 新增热门搜索
     * @param unknown $data
     */
    public function addSearch($data){
        return $this->insert($data);
    }
    
    /**
     * 更新热门搜索
     * @param unknown $condition
     * @param unknown $update
     */
    public function updateSearch($condition,$update){
        $result=$this->where($condition)->update($update);
        return $result;
    }
    
    /**
     * 获取单个热门搜索
     * @param unknown $condition
     * @param string $field
     */
    
    public function getSearchInfo($condition, $field = '*'){
        return $this->field($field)->where($condition)->find();
    }
    
    /**
     * 删除热门搜索
     * @param unknown $where
     */
    public function delSearch($where){
        return $this->where($where)->delete();
    }
}